import 'package:flutter/material.dart';

class Input extends StatelessWidget {
  Input({
    this.onChange,
    this.maxLength = 11,
    this.type = TextInputType.number,
    this.autofocus = false,
    this.bgColor = 0xFFCACACA,
    this.placeholder = '请输入手机号',
  });
  final int maxLength;
  final TextInputType type;
  final bool autofocus;
  final int bgColor;
  final String placeholder;
  final Function onChange;

  @override
  Widget build(BuildContext context) {
    return Container(
      child: TextField(
        keyboardType: this.type,
        maxLength: this.maxLength,
        onTap: () {},
        onChanged: (e) {
          onChange(e);
        },
        autofocus: false,
        style: TextStyle(fontSize: 13, color: Color(0xFF000000)),
        decoration: InputDecoration(
          counterText: '',
          // isDense: true,
          filled: true,
          hintText: this.placeholder,
          hintStyle: TextStyle(
            color: Color(0xFF777777),
            fontSize: 14,
          ),
          border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(24),
            borderSide: BorderSide.none,
          ), //去掉输入框的下滑线,
          fillColor: Color(this.bgColor),
          contentPadding: EdgeInsets.fromLTRB(18, 14, 18, 14),
        ),
      ),
    );
  }
}
